package org.jeecg.modules.system.allsmslog.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.param.station.entity.BikeStation;
import org.jeecg.modules.system.allsmslog.entity.BikeSysSmsLog;
import org.jeecg.modules.system.allsmslog.service.BikeSysSmsLogService;
import org.jeecg.modules.system.messagelog.entity.BikeSysMessageLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * 月月鸟
 */
@Api(tags="短息发送记录")
@RestController
@RequestMapping("/msgLog/bikeSysSmsLog")
@Slf4j
public class BikeSysSmsLogController {
    @Autowired
    private BikeSysSmsLogService bikeSysSmsLogService;


    /**
     * 分页列表查询
     *
     * @param bikeSysSmsLog
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @ApiOperation(value="短息发送记录-分页列表查询", notes="短息发送记录-分页列表查询")
    @GetMapping(value = "/pageList")
    public Result<?> queryPageList(BikeSysSmsLog bikeSysSmsLog,
                                   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
                                   HttpServletRequest req) {
        Page<BikeSysSmsLog> page = new Page<>(pageNo, pageSize);
        Page<BikeSysSmsLog> bikeSysSmsLogPage = bikeSysSmsLogService.pageList(bikeSysSmsLog, page);
        return Result.OK(bikeSysSmsLogPage);
    }

    @ApiOperation(value="短息发送记录-添加", notes="短息发送记录-添加")
    @PostMapping(value = "/add")
    public Result<?> add (@RequestBody BikeSysSmsLog bikeSysSmsLog){
        bikeSysSmsLogService.add(bikeSysSmsLog);
        return Result.OK();
    }

    /**
     * 导出excel
     *
     * @param request
     * @param bikeSysSmsLog
     */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, BikeSysSmsLog bikeSysSmsLog) {
        return bikeSysSmsLogService.exportXls(request,bikeSysSmsLog);
    }
}
